Skip to content

信件與性別問題#2

Open
paperhsiaooo wants to merge 1 commit intocode-review2-startfrom
code-review2-PR
Open

信件與性別問題#2
paperhsiaooo wants to merge 1 commit intocode-review2-startfrom
code-review2-PR

Conversation

@paperhsiaooo
Copy link
Copy Markdown
Owner

Hi, all
已經修正信件與性別問題,再麻煩協助 review 了 🙏

@paperhsiaooo paperhsiaooo self-assigned this Nov 11, 2023
@paperhsiaooo
Copy link
Copy Markdown
Owner Author

/gemini

@gemini-code-assist
Copy link
Copy Markdown

It looks like you ran the /gemini command without specifying an argument. To perform a code review, please use /gemini review. For a list of available commands, use /gemini help.

@paperhsiaooo
Copy link
Copy Markdown
Owner Author

/gemini help

@gemini-code-assist
Copy link
Copy Markdown

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.

@paperhsiaooo
Copy link
Copy Markdown
Owner Author

/gemini review

@gemini-code-assist
Copy link
Copy Markdown

Warning

Gemini encountered an error creating the review. You can try again by commenting /gemini review.

@paperhsiaooo
Copy link
Copy Markdown
Owner Author

/gemini review

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

The pull request addresses issues related to email and gender validation. The changes include adding email length validation, gender format validation, and modifying the return value of getActivityString to include a success flag and a result message. The alert message is displayed based on the success flag.

Summary of Findings

  • Email length validation: The email length validation is added to check if the email length is less than 20. This might be too restrictive and should be configurable or removed.
  • Gender format validation: The gender format validation is added to check if the gender is either 1 or 2. This is good for ensuring data integrity.
  • Return value of getActivityString: The return value of getActivityString is modified to include a success flag and a result message. This is a good practice for handling errors and providing feedback to the user.

Merge Readiness

The pull request is almost ready to be merged. The email length validation might be too restrictive and should be configurable or removed. I am unable to directly approve the pull request, and users should have others review and approve this code before merging.

Comment thread src/pages/about/index.js
Comment on lines +21 to +23
if(payload.email.length < 20) {
return false
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The email length validation might be too restrictive. Consider making this configurable or removing it altogether. What is the rationale behind the length check?

Suggested change
if(payload.email.length < 20) {
return false
}
// Consider removing or making this configurable
// if(payload.email.length < 20) {
// return false
// }

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because I don’t want users to enter random emails, I want to limit the length of the email field.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for clarifying your reasoning. While I understand the intent to prevent random email entries, a simple length check might not be the most effective way to validate email format. Users could still enter long strings of gibberish that pass the length check but are not valid emails.

Consider using a more robust email validation method, such as a regular expression, or a third-party library specifically designed for email validation. This would provide a more accurate way to ensure that the entered email is in a valid format.

Suggested change
if(payload.email.length < 20) {
return false
}
// if(payload.email.length < 20) {
// return false
// }

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're welcome. I'm glad I could help. Let me know if you have any further questions.

Comment thread src/pages/about/index.js
Comment on lines +59 to +61
if(!activityString.success) {
alert(activityString.result)
} else {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Consider using a more user-friendly way to display the error message instead of alert. A modal or an inline error message would be better.

// alert(activityString.result)
        // TODO: Implement a better way to display the error message
        // e.g., using a modal or an inline error message

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Due to the tight schedule, using alerts was allowed after discussion with the team.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Understood. Given the team's decision to use alerts due to the schedule, I won't push further on that point. However, for future reference and when time allows, consider exploring alternative methods for displaying error messages to enhance the user experience. Thanks for the update, @paperhsiaooo!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant